<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use DB;


class UserAccountSuggest extends Authenticatable
{
    use Notifiable;
	protected $table = 'suggest';


    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
         'remember_token',
    ];

	public static  function getUserAccountSuggest($phone = ''){
		if(!$phone){
			$userSg = DB::table('suggest')
				->join('user_account', 'suggest.open_id', '=', 'user_account.open_id')
				->select('suggest.*', 'user_account.phone')
				->get()
				->toArray();
		}else{
			$userSg = DB::table('suggest')
				->join('user_account', 'suggest.open_id', '=', 'user_account.open_id')
				->where('user_account.phone', 'like', '%'.$phone.'%')
				->select('suggest.*', 'user_account.phone')
				->get()
				->toArray();
		}
		if(!$userSg){
			return array();
		}
		return $userSg;
	}









}
